<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sub_account_repay_logs', function (Blueprint $table) {
            $table->id();

            $table->unsignedInteger('sub_account_id')->comment('子账号id');
            $table->dateTime('before_service_time_end')->nullable()->comment('续费前服务结束时间');
            $table->dateTime('after_service_time_end')->nullable()->comment('续费后服务结束时间');
            $table->decimal('repay_amount',12,1)->nullable()->comment('续费金额');
            $table->unsignedInteger('repay_admin_id')->comment('续费人id');
            $table->tinyInteger('is_deduct')->default(0)->comment('是否抵扣：默认0否，1是');

            $table->timestamps();
        });


        \DB::statement("ALTER TABLE `sub_account_repay_logs` comment '续费记录表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sub_account_repay_logs');
    }
};
